package lucky.xiong.certifacte.加解密;


import java.util.Base64;

public class JWT {

    public static void main(String[] args) {
            String token ="eyJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50cyI6WyJuZXciXSwiYWNyIjoiMCIsImFjdGl2ZSI6dHJ1ZSwiYXVkIjpbIjM3NzMzNiJdLCJhdXRoX3RpbWUiOjE2NjY2OTE3Mzg3MTQsImF6cCI6ImYyZjg1YTc3LTgyNmItNDhmMC1hNTI3LTMyYjgyMzIxMzdiYyIsImVtYWlsIjoiMUBxcS5jb20iLCJleHAiOjE2NjY3MjA1Mzg3NDQsImV4cGlyZWQiOmZhbHNlLCJpYXQiOjE2NjY2OTE3Mzg3NDcsImlzX2FkbWluIjpmYWxzZSwiaXNzIjoiaHR0cHM6Ly93d3cucWlhbnhpbi5jb20iLCJqdGkiOiIyYWI2OTI5YWRlNWU0NGM4OGNjNWFlM2NlNDg1MmVhOSIsIm5hbWUiOiJodWFuZ3l1YW4wNCIsIm5iZiI6MTY2NjY5MTczOCwib3RoZXJDbGFpbXMiOnt9LCJwaG9uZV9udW1iZXIiOiIxMTExMTExMTExMSIsInJlc291cmNlX2FjY2VzcyI6e30sInNlc3Npb25JZCI6IjE2dUYzc2VGUE5GMUFmd1ZGS1pXcjNGYVFmSEZybkNLbTNveCIsInNlc3Npb25fc3RhdGUiOiIxNnVGM3NlRlBORjFBZndWRktaV3IzRmFRZkhGcm5DS20zb3giLCJzdWIiOiI5Yjc0Y2IxMC0xMDlhLTRlYTgtOWViNy1kNjY3NTAwYzViNWIiLCJ0eXAiOiJJRCIsInZlcmlmeUNhbGxlciI6ZmFsc2V9.6MIk9IATDd9Utw5GvRC5tUz1JrAST7Lkx8Dv2dT3w1g";
            String[] split = token.split("\\.");
            System.out.println("头："+ split[0]);
            System.out.println("体："+ split[1]);
            System.out.println("尾："+ split[2]);
            System.out.println("解密 base64");
            Base64.Decoder decoder = Base64.getDecoder();
            System.out.println("头："+ new String(decoder.decode(split[0])));
            System.out.println("体："+ new String(decoder.decode(split[1])));
            System.out.println("尾："+ new String(Base64.getUrlDecoder().decode(split[2])));
    }

}
